package com.yidu.verycd_background.uilt;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class JDBCtools {
    public static String uploadFile(MultipartFile file){
        String fileyuan=file.getOriginalFilename();
        String hozui = fileyuan.substring(fileyuan.lastIndexOf("."));
        String fileName= UUID.randomUUID().toString() + hozui;
        File target = new File("E://upload//"+fileName);
        try {
            System.out.println("保存路径："+ target);
            file.transferTo(target);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return fileName;
    }
}
